<ui:composition xmlns="http://www.w3.org/1999/xhtml"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                xmlns:h="http://java.sun.com/jsf/html"
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.org/ui"
                template="/templates/ui.xhtml">

    <ui:define name="head">
        <script language="JavaScript" type="text/JavaScript">
            document.onkeydown = function TabReplace() {
                if (event.keyCode == 13) {
                    if (event.srcElement.id == 'form:irtnam') {
                        event.returnValue = false;
                        event.cancel = true;
                        document.forms['form']['form:query'].click();
                    } else {
                        event.keyCode = 9;
                    }
                }
            }
        </script>
    </ui:define>

    <ui:define name="content">
        <div class="entry">
            <h:form id="form">
                <p:focus for="curcde"/>
                <p:growl id="msgs" showDetail="false"/>
                <p:panel>
                    <h:panelGrid columns="2" cellspacing="5">
                        <h:panelGrid columns="4" cellspacing="5" cellpadding="0">
                            <h:outputLabel value="币别:" style="width: 160px;text-align: right;"/>
                            <p:inputText id="curcde" value="#{actirtAction.curcde}"
                                         required="true" requiredMessage="必须输入币别."/>
                            <h:outputLabel value="日期:" style="width: 160px;text-align: right;"/>
                            <p:inputText id="irtdate" value="#{actirtAction.irtdate}"
                                         required="true"
                                         onclick="WdatePicker({dateFmt:'yyyyMMdd'})"/>
                        </h:panelGrid>
                        <h:panelGrid columns="1" cellspacing="5" cellpadding="0" style="margin-left: 300px;"
                                     width="10%">
                            <p:commandButton id="btn" style="width:100px;" value="查询"
                                             action="#{actirtAction.onQuery()}"
                                             ajax="true" update="msgs,dt">
                            </p:commandButton>

                        </h:panelGrid>
                    </h:panelGrid>
                </p:panel>
                <br/>
                <p:dataTable id="dt" height="200"
                             value="#{actirtAction.dataList}" var="record" selectionMode="single"
                             paginatorTemplate="{FirstPageLink} {PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink} {RowsPerPageDropdown}"
                             paginator="true" paginatorPosition="bottom" rows="15" rowsPerPageTemplate="100,50,15,10,5"
                             emptyMessage="数据记录为空...">

                    <p:column headerText="货币码" style="text-align:center">
                        <h:outputText value="#{record.CURCDE}"/>
                    </p:column>

                    <p:column headerText="启用日期" style="text-align:center">
                        <h:outputText value="#{record.EXTDAT}">
                            <f:convertDateTime pattern="yyyy-MM-dd" timeZone="GMT+8" locale="cn"/>
                        </h:outputText>
                    </p:column>
                    <p:column headerText="利率名称" style="text-align:left">
                        <h:outputText value="#{record.IRTNAM}"/>
                    </p:column>
                    <p:column headerText="利率码" style="text-align:center">
                        <h:outputText value="#{record.IRTCDE}"/>
                    </p:column>
                    <p:column headerText="基准利率值" style="text-align:right">
                        <h:outputText value="#{record.BASIRT}"/>
                    </p:column>
                </p:dataTable>
            </h:form>
        </div>
    </ui:define>
</ui:composition>